﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace OmniKits.Windows.Scripting
{
    public class JScriptHost : ActiveScriptHost<ActiveScriptEngines.JScript>
    {
        public JScriptHost(ScriptLanguageVersion version = ScriptLanguageVersion.Default, bool useSafe = true)
            : this(new ActiveScriptEngines.JScript(), version, useSafe)
        { }

        public JScriptHost(ActiveScriptEngines.JScript engine, ScriptLanguageVersion version = ScriptLanguageVersion.Default, bool useSafe = true)
            : base(engine, useSafe)
        {
            if (version == ScriptLanguageVersion.Default)
                return;

            var iProp = (IActiveScriptProperty)engine;
            object ver = (int)version;
            iProp.SetProperty(ScriptProperty.InvokeVersioning, UIntPtr.Zero, ref ver);
        }
    }
}
